﻿using sqlsearcher.Models;
using sqlsearcher.Services;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace sqlsearcher.Forms
{
    public partial class NameFrm : Form
    {
        public string backSource = "";
        public string name = "";
        public NameFrm()
        {
            InitializeComponent();
        }

        private void NameFrm_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(textBox1.Text))
                return;

            if (backSource == AppConst.source_bianqian)
            {
                foreach (ListViewItem item in TFac<MenuFm>.Instance.lvPList.Items)
                {
                    if (item.Text.ToLower() == textBox1.Text.Trim().ToLower())
                    {
                        MessageBox.Show("已存在该便签","消息提示");
                        return;
                    }
                }
                TFac<BianQianData>.Instance.Add(TFac<MenuFm>.Instance.lvPList, textBox1.Text, TFac<MenuFm>.Instance.rtxtBianQian.Text);
                this.Hide();
            }
        }
    }
}
